from django.contrib import admin
from apps.users.models import StreamerInfoModel, PlayerInfoModel


# Register your models here.


class StreamerInfoAdmin(admin.ModelAdmin):
    """
    主播信息管理类
    """
    list_display = ['id', 'name', 'is_password', 'password',
                    'live_platform', 'live_platform_number', 'is_allow', 'allow_datetime', 'checker',
                    'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'is_password', 'password',
              'live_platform', 'live_platform_number', 'is_allow', 'allow_datetime', 'checker',
              'expand_json', 'created_time']
    list_filter = ['id', 'name', 'is_password', 'password',
                   'live_platform', 'live_platform_number', 'is_allow', 'allow_datetime', 'checker',
                   'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'is_password', 'password',
                     'live_platform', 'live_platform_number', 'is_allow', 'allow_datetime', 'checker',
                     'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class PlayerInfoAdmin(admin.ModelAdmin):
    """
    玩家信息管理类
    """
    list_display = ['id', 'name', 'is_password', 'password', 'live_platform',
                    'live_platform_number', 'is_active', 'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'is_password', 'password', 'live_platform',
              'live_platform_number', 'is_active', 'expand_json', 'created_time']
    list_filter = ['id', 'name', 'is_password', 'password', 'live_platform',
                   'live_platform_number', 'is_active', 'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'is_password', 'password', 'live_platform',
                     'live_platform_number', 'is_active', 'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


admin.site.register(StreamerInfoModel, StreamerInfoAdmin)
admin.site.register(PlayerInfoModel, PlayerInfoAdmin)
